package org.ims.inv.service.system;

import java.util.List;

import org.ims.inv.model.system.ModelAppDictionary;

import cn.trymore.core.exception.DAOException;
import cn.trymore.core.exception.ServiceException;
import cn.trymore.core.service.ServiceGeneric;

/**
 * Service: 系统字典
 * 
 * @author Jeccy.Zhao
 *
 */
public interface ServiceAppDictionary
extends ServiceGeneric<ModelAppDictionary>
{
	/**
	 * Obtains entity by dictionary key
	 * 
	 * @param key
	 * @return
	 * @throws ServiceException
	 */
	ModelAppDictionary getByKey (String key) 
			throws ServiceException;
	
	/**
	 * Obtains entity by dictionary type and key
	 * 
	 * @param key
	 * @param name
	 * @return
	 * @throws ServiceException
	 */
	ModelAppDictionary getByTypeAndKey (String key, String name)
			throws ServiceException;
	
	/**
	 * Obtains entity by dictionary type
	 * 
	 * @param type
	 * @return
	 * @throws DAOException
	 * */
	List<ModelAppDictionary> getByType(String type) throws ServiceException;
	
	/**
	 * Returns true only when the specified dictionary type and value existed in database
	 * 
	 * @param type
	 * @param value
	 * @return
	 * @throws DAOException
	 * */
	boolean isDictItemExisted(String type, String value) throws ServiceException;
	
	/**
	 * Returns true only when the specified dictionary type and value existed in database
	 * 
	 * @param type
	 * @param value
	 * @param id
	 * @return
	 * @throws DAOException
	 * */
	boolean isDictItemExisted(String type, String value, String id) throws ServiceException;
	
}
